package com.hx.voice.recognition.admin.manager.service.impl;

import com.ace.cache.annotation.Cache;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hx.voice.recognition.admin.manager.entity.Element;
import com.hx.voice.recognition.admin.manager.mapper.ElementMapper;
import com.hx.voice.recognition.admin.manager.service.IElementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jack
 * @since 2019-06-12
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class ElementServiceImpl extends ServiceImpl<ElementMapper, Element> implements IElementService {

    @Autowired
    private ElementMapper elementMapper;

    @Override
    @Cache(key = "permission:ele")
    public List<Element> selectElemetnList() {
        return elementMapper.selectAllElementPermissions();
    }

    @Override
    @Cache(key = "permission:ele:u{1}")
    public List<Element> getAuthrityElementByUserId(Integer id) {
        return elementMapper.getAuthrityElementByUserId(id);
    }


}
